package com.only4play.practice.common.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.only4play.codegen.support.constants.BaseEnum;

import java.util.Optional;

/**
 * @author mdy
 * * @date 2024/9/27
 */
public enum IncomeType  implements BaseEnum<IncomeType> {


    TEMP_CAR_PARKING(10, "临停车费"),
    CAR_MONTH_CARD_ADD(20, "添加车辆月卡类型"),
    // 车辆月卡类型续费
    CAR_MONTH_CARD_RENEW(21, "车辆月卡续费"),
    // 车辆月卡类型延期
    CAR_MONTH_CARD_EXTEND(22, "车辆月卡延期"),
    // 车辆月卡类型退款
    CAR_MONTH_CARD_REFUND(23, "车辆月卡退款"),

    ;

    IncomeType(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    @EnumValue
    private Integer code;
    private String name;

    @Override
    public Integer getCode() {
        return this.code;
    }

    @Override
    public String getName() {
        return this.name;
    }

    public static Optional<IncomeType> of(Integer code) {
        return Optional.ofNullable(BaseEnum.parseByCode(IncomeType.class, code));
    }

}
